var mouse_pos;
const HotKey_Codes = [['m1', 0x01]
  , ['m2', 0x02]
  , ['m3', 0x04]
  , ['m4', 0x05]
  , ['m5', 0x06]
  , ['0', 0x30]
  , ['1', 0x31]
  , ['2', 0x32]
  , ['3', 0x33]
  , ['4', 0x34]
  , ['5', 0x35]
  , ['6', 0x36]
  , ['7', 0x37]
  , ['8', 0x38]
  , ['9', 0x39]
  , ['A', 0x41]
  , ['B', 0x42]
  , ['C', 0x43]
  , ['D', 0x44]
  , ['E', 0x45]
  , ['F', 0x46]
  , ['G', 0x47]
  , ['H', 0x48]
  , ['I', 0x49]
  , ['J', 0x4A]
  , ['K', 0x4B]
  , ['L', 0x4C]
  , ['M', 0x4D]
  , ['N', 0x4E]
  , ['O', 0x4F]
  , ['P', 0x50]
  , ['Q', 0x51]
  , ['R', 0x52]
  , ['S', 0x53]
  , ['T', 0x54]
  , ['U', 0x55]
  , ['V', 0x56]
  , ['W', 0x57]
  , ['X', 0x58]
  , ['Y', 0x59]
  , ['Z', 0x5A]
  , ['Lwin', 0x5B]
  , ['Rwin', 0x5C]
  , ['num0', 0x60]
  , ['num1', 0x61]
  , ['num2', 0x62]
  , ['num3', 0x63]
  , ['num4', 0x64]
  , ['num5', 0x65]
  , ['num6', 0x66]
  , ['num7', 0x67]
  , ['num8', 0x68]
  , ['num9', 0x69]
  , ['F1', 0x70]
  , ['F2', 0x71]
  , ['F3', 0x72]
  , ['F4', 0x73]
  , ['F5', 0x74]
  , ['F6', 0x75]
  , ['F7', 0x76]
  , ['F8', 0x77]
  , ['F9', 0x78]
  , ['F10', 0x79]
  , ['F11', 0x7A]
  , ['F12', 0x7B]
  , ['sft', 0x10]
  , ['ctrl', 0x11]
  , ['back', 0x08]
  , ['tab', 0x09]
  , ['enter', 0x0D]
  , ['alt', 0x12]
  , ['pause', 0x13]
  , ['caps', 0x14]
  , ['ESC', 0x1B]
  , ['space', 0x20]
  , ['PUP', 0x21]
  , ['PDW', 0x22]
  , ['END', 0x23]
  , ['HOME', 0x24]
  , ['<-', 0x25]
  , ['UP', 0x26]
  , ['DW', 0x28]
  , ['->', 0x27]
  , ['sel', 0x29]
  , ['PS', 0x2C]
  , ['INS', 0x2D]
  , ['DEL', 0x2E]
];
const Transferr = {
  "Lable": 0x30,
  "CheckBox": 0x31,
  "IntSlider": 0x32,
  "FloatSlider": 0x33,
  "ColorPicker": 0x34,
  "DropDown": 0x35,
  "MultiDropDown": 0x36,
  "HotKey": 0x37
};
function Somethingneeds () {
  mouse_pos = Global.GetCursorPosition();
} Global.RegisterCallback("Draw", "Somethingneeds");
function HSVToRGB (arr) {
  var h = arr[0], s = arr[1], v = arr[2];
  s = s / 100;
  v = v / 100;
  var r = 0, g = 0, b = 0;
  var i = parseInt((h / 60) % 6);
  var f = h / 60 - i;
  var p = v * (1 - s);
  var q = v * (1 - f * s);
  var t = v * (1 - (1 - f) * s);
  switch (i) {
    case 0:
      r = v; g = t; b = p;
      break;
    case 1:
      r = q; g = v; b = p;
      break;
    case 2:
      r = p; g = v; b = t;
      break;
    case 3:
      r = p; g = q; b = v;
      break;
    case 4:
      r = t; g = p; b = v;
      break;
    case 5:
      r = v; g = p; b = q;
      break;
    default:
      break;
  }
  r = parseInt(r * 255.0)
  g = parseInt(g * 255.0)
  b = parseInt(b * 255.0)
  return [r, g, b, 255];
}
function sleep (milliSeconds) {
  var startTime = new Date().getTime();
  while (new Date().getTime() < startTime + milliSeconds);
}
function mouse_in_rect (x, y, w, h) { //鼠标在范围内
  mouse_pos = Global.GetCursorPosition();
  if (mouse_pos[0] >= x && mouse_pos[0] <= x + w && mouse_pos[1] >= y && mouse_pos[1] <= y + h) {
    return true;
  } else { return false; }
}
function mouse_left_click () { //检测左键
  if (Global.IsKeyPressed(0x1)) {
    return true;
  } else { return false; }
}
function mouse_right_click () { //检测右键
  if (Global.IsKeyPressed(0x2)) {
    return true;
  } else { return false; }
}
var Set_Visible = function (path, name, statu) {
  for (var contials = 1; contials < path.length; contials++) {
    if (path[contials][2] == name) {
      path[contials][1] = statu;
    }
  }
}
var Add_Lable = function (path, name) {
  path.push([Transferr.Lable, 1, name]);
}
var Add_CheckBox = function (path, name, displayname) {
  UI.AddCheckbox(name);
  UI.SetEnabled(name, false);
  UI.AddSliderInt(name + "K", 0, 5);
  UI.SetEnabled(name + "K", false);
  path.push([Transferr.CheckBox, 1, name, displayname]);
}
var Add_IntSlider = function (path, name, displayname, min, max) {
  UI.AddSliderInt(name, min, max);
  UI.SetEnabled(name, false);
  UI.AddSliderInt(name + "K", 0, 5);
  UI.SetEnabled(name + 'K', false);
  path.push([Transferr.IntSlider, 1, name, displayname, min, max]);
}
var Add_FloatSlider = function (path, name, displayname, min, max) {
  UI.AddSliderFloat(name, min, max);
  UI.SetEnabled(name, false);
  UI.AddSliderInt(name + "K", 0, 5);
  UI.SetEnabled(name + 'K', false);
  path.push([Transferr.FloatSlider, 1, name, displayname, min, max]);
}
var Add_ColorPicker = function (path, name) {

  UI.AddSliderInt(name + "H", 0, 360);
  UI.AddSliderInt(name + "S", 0, 100);
  UI.AddSliderInt(name + "V", 0, 100);
  UI.AddSliderInt(name + "R", 0, 255);
  UI.AddSliderInt(name + "G", 0, 255);
  UI.AddSliderInt(name + "B", 0, 255);
  UI.AddSliderInt(name + "A", 0, 255);
  UI.AddCheckbox(name + 'F');
  UI.SetEnabled(name + 'R', false);
  UI.SetEnabled(name + 'G', false);
  UI.SetEnabled(name + 'B', false);
  UI.SetEnabled(name + 'A', false);
  UI.SetEnabled(name + 'H', false);
  UI.SetEnabled(name + 'S', false);
  UI.SetEnabled(name + 'V', false);
  UI.SetEnabled(name + 'F', false); 
  path.push([Transferr.ColorPicker, 1, name, [UI.GetValue(name + "R"), UI.GetValue(name + "G"), UI.GetValue(name + "B"), UI.GetValue(name + "A")]]);
}
var Add_DropDown = function (path, name, elements) {
  UI.AddDropdown(name, elements);
  UI.AddCheckbox(name + '0');
  UI.SetEnabled(name, false);
  UI.SetEnabled(name + '0', false);
  path.push([Transferr.DropDown, 1, name, elements]);
}
var Add_MultiDropDown = function (path, name, elements) {
  UI.AddCheckbox(name);
  UI.SetEnabled(name, false);
  for (var create_m = 0; create_m < elements.length; create_m++) {
    UI.AddCheckbox(name + create_m.toString());
    UI.SetEnabled(name + create_m.toString(), false);
  }
  path.push([Transferr.MultiDropDown, 1, name, elements]);
}
var Add_HotKey = function (path, name) {
  UI.AddSliderInt(name + '0', 0, 2);
  UI.AddSliderInt(name + '1', 0, HotKey_Codes.length);
  UI.AddCheckbox(name + '2');
  UI.AddCheckbox(name + '3');
  UI.AddSliderInt(name + 'l', 0, 14);
  UI.AddCheckbox(name + '4');
  UI.SetEnabled(name + '0', false);
  UI.SetEnabled(name + '1', false);
  UI.SetEnabled(name + '2', false);
  UI.SetEnabled(name + '3', false);
  UI.SetEnabled(name + '4', false);
  UI.SetEnabled(name + 'l', false);
  path.push([Transferr.HotKey, 1, name, UI.GetValue(name + '1')]);
}
var Draw_Lable = function (x, y, path, i) {
  if (path[i][1] == 1) {
    Render.StringCustom(x, y, 0, path[i][2], [255, 255, 255, 255], Render.AddFont('Ebrima', 8, 150));
    path[0].push(0);
  }
}
var Draw_CheckBox = function (x, y, path, i) {
  if (path[i][1] == 1) {
    Render.Rect(x, y + 4, 7, 7, [255, 255, 255, 255]);
    Render.StringCustom(x + 10, y - 4 + 4, 0, path[i][3], [255, 255, 255, 255], Render.AddFont('Ebrima', 8, 150));
    checkbox_statu = UI.GetValue('Misc', 'JAVASCRIPT', 'Script items', path[i][2])
    if (checkbox_statu) {
      Render.FilledRect(x + 2, y + 2 + 4, 3, 3, [255, 255, 255, 255]);
    }
    if (mouse_in_rect(x, y + 4, 7, 7) && Input.IsKeyPressed(0x01)) {
      UI.SetValue((path[i][2] + 'K'), UI.GetValue(path[i][2] + 'K') + 1)
      if (UI.GetValue(path[i][2] + 'K') >= 1 && UI.GetValue(path[i][2] + 'K') < 4) {
        UI.SetValue(path[i][2], !UI.GetValue(path[i][2]));
      }
    } else { UI.SetValue('Misc', 'JAVASCRIPT', 'Script items', path[i][2] + 'K', 0); }
    path[0].push(0);
  }
}
var Draw_Slider = function (x, y, path, i) {
  if (path[i][1] == 1) {
    Render.StringCustom(x, y + 4, 0, path[i][3], [255, 255, 255, 255], Render.AddFont('Ebrima', 8, 150));
    Render.Rect(x, y + 22, 180, 7, [100, 100, 100, 255]);
    if (path[i][4] <= 0) {
      var slider_w = Math.abs(UI.GetValue('Misc', 'JAVASCRIPT', 'Script items', path[i][2]) + Math.abs(path[i][4])) * (180 / (path[i][5] - path[i][4]))
    } else {
      var slider_w = Math.abs((UI.GetValue('Misc', 'JAVASCRIPT', 'Script items', path[i][2]) - path[i][4]) * (180 / (path[i][5] - path[i][4])))
    }


    Render.FilledRect(x, y + 23, slider_w, 5, [0, 255, 0, 255]);
    if (mouse_in_rect(x, y + 22, 180, 7)) {
      if (mouse_left_click()) {
        if (path[i][4] <= 0) {
          UI.SetValue('Misc', 'JAVASCRIPT', 'Script items', path[i][2], ((path[i][5] - path[i][4]) / 180)
            * (mouse_pos[0] - x) + path[i][4])
        } else {
          UI.SetValue('Misc', 'JAVASCRIPT', 'Script items', path[i][2], ((path[i][5] - path[i][4]) / 180)
            * (mouse_pos[0] - x) + path[i][4])
        }

      }
    }
    if (path[i][0] == Transferr.IntSlider) {
      Render.StringCustom(x + slider_w, y + 20, 1, Math.floor(UI.GetValue('Misc', 'JAVASCRIPT', 'Script items', path[i][2])).toString(), [0, 0, 0, 255], Render.AddFont('Ebrima', 9, 700));
      Render.StringCustom(x + slider_w, y + 20, 1, Math.floor(UI.GetValue('Misc', 'JAVASCRIPT', 'Script items', path[i][2])).toString(), [255, 255, 255, 255], Render.AddFont('Ebrima', 8, 700));
    } else {
      Render.StringCustom(x + slider_w, y + 20, 1, UI.GetValue('Misc', 'JAVASCRIPT', 'Script items', path[i][2]).toFixed(2).toString(), [0, 0, 0, 255], Render.AddFont('Ebrima', 9, 700));
      Render.StringCustom(x + slider_w, y + 20, 1, UI.GetValue('Misc', 'JAVASCRIPT', 'Script items', path[i][2]).toFixed(2).toString(), [255, 255, 255, 255], Render.AddFont('Ebrima', 8, 700));
    }
    path[0].push(0, 0);
  }
}
var Draw_DropDown = function (x, y, path, i) {
  if (path[i][1] == 1) {
    Render.StringCustom(x, y + 3, 0, path[i][2], [255, 255, 255, 255], Render.AddFont('Ebrima', 8, 150));
    Render.FilledRect(x, y + 18, 180, 18, [37, 37, 36, 255]);
    Render.Rect(x, y + 18, 180, 18, [150, 150, 150, 255])
    Render.StringCustom(x + 6, y + 3 + 18, 0, path[i][3][UI.GetValue('Misc', 'JAVASCRIPT', 'Script items', path[i][2])], [255, 255, 255, 255], Render.AddFont('Ebrima', 8, 150));
    if (mouse_in_rect(x, y + 18, 180, 18)) {
      if (mouse_left_click()) {
        UI.SetValue('Misc', 'JAVASCRIPT', 'Script items', path[i][2] + '0', 1)
      }
    } else {
      if (!mouse_in_rect(x, y + 18, 180, (path[i][3].length + 1) * 18)) {
        if (mouse_left_click() || mouse_right_click()) {
          UI.SetValue('Misc', 'JAVASCRIPT', 'Script items', path[i][2] + '0', 0)
        }
      }
    }

    if (UI.GetValue('Misc', 'JAVASCRIPT', 'Script items', path[i][2] + '0')) {
      for (var drop = 0; drop < path[i][3].length; drop++) {
        Render.FilledRect(x, y + 18 + (drop + 1) * 18, 180, 18, [37, 37, 36, 255])

        if (UI.GetValue('Misc', 'JAVASCRIPT', 'Script items', path[i][2]) == drop) {
          Render.StringCustom(x + 10, y + 18 + (drop + 1) * 18 + 2, 0, path[i][3][drop], [127, 255, 170, 255], Render.AddFont('Ebrima', 7, 150));
        } else { Render.StringCustom(x + 10, y + 18 + (drop + 1) * 18 + 2, 0, path[i][3][drop], [255, 255, 255, 255], Render.AddFont('Ebrima', 7, 150)); }
        if (mouse_in_rect(x, y + 18 + (drop + 1) * 18, 180, 18) && mouse_left_click()) {
          UI.SetValue('Misc', 'JAVASCRIPT', 'Script items', path[i][2], drop);
          UI.SetValue('Misc', 'JAVASCRIPT', 'Script items', path[i][2] + '0', 0);
          sleep(140);
        }
        path[0].push(0);
      }


    }
    path[0].push(0, 0);
  }


}
var Draw_MultiDropDown = function (x, y, path, i) {
  if (path[i][1] == 1) {
    Render.StringCustom(x, y + 3, 0, path[i][2], [255, 255, 255, 255], Render.AddFont('Ebrima', 8, 150));
    Render.FilledRect(x, y + 18, 180, 18, [37, 37, 36, 255]);
    Render.Rect(x, y + 18, 180, 18, [150, 150, 150, 255])

    Array.prototype.contains = function (x) {
      for (var i = 0; i < this.length; i++) {
        if (this[i] == x) return true;
      }
      return false;
    }
    Array.prototype.order = function (x) {
      for (var i = 0; i < this.length; i++) {
        if (this[i] == x) return i;
      }
      return false;
    }
    Array.prototype.size = function (x) {
      var size_ar = 0;
      for (var i = 0; i < this.length; i++) {
        if (this[i] == x) size_ar++
      }
      return size_ar;
    }

    if (UI_GetValue(path, path[i][2]).contains(1)) {

      if (UI_GetValue(path, path[i][2]).size(1) >= 2) {
        Render.StringCustom(x + 5, y + 3 + 18, 0, path[i][3][UI_GetValue(path, path[i][2]).order(1)] + "...", [255, 255, 255, 255], Render.AddFont('Ebrima', 8, 150));

      } else {
        Render.StringCustom(x + 5, y + 3 + 18, 0, path[i][3][UI_GetValue(path, path[i][2]).order(1)], [255, 255, 255, 255], Render.AddFont('Ebrima', 8, 150));
      }
    } else {
      Render.StringCustom(x + 5, y + 3 + 18, 0, "None", [255, 255, 255, 255], Render.AddFont('Ebrima', 8, 150));
    }

    if (mouse_in_rect(x, y + 18, 180, 18)) {
      if (mouse_left_click()) {
        UI.SetValue(path[i][2], 1)
      }
    } else {
      if (!mouse_in_rect(x, y + 18, 180, (path[i][3].length + 1) * 18)) {
        if (mouse_left_click() || mouse_right_click()) {
          UI.SetValue(path[i][2], 0)
        }
      }
    }

    if (UI.GetValue(path[i][2])) {
      for (var multidrop = 0; multidrop < path[i][3].length; multidrop++) {
        Render.FilledRect(x, y + 18 + (multidrop + 1) * 18, 180, 18, [37, 37, 36, 255])
        if (UI.GetValue(path[i][2] + multidrop.toString())) {
          Render.StringCustom(x + 10, y + 18 + (multidrop + 1) * 18 + 2, 0, path[i][3][multidrop], [127, 255, 170, 255], Render.AddFont('Ebrima', 7, 150));
        } else { Render.StringCustom(x + 10, y + 18 + (multidrop + 1) * 18 + 2, 0, path[i][3][multidrop], [255, 255, 255, 255], Render.AddFont('Ebrima', 7, 150)); }
        if (mouse_in_rect(x, y + 18 + (multidrop + 1) * 18, 180, 18) && mouse_left_click()) {
          UI.SetValue(path[i][2] + multidrop.toString(), !UI.GetValue(path[i][2] + multidrop.toString()))
          sleep(120);
        }
        path[0].push(0);
      }

    }

    path[0].push(0, 0);
  }
}
function Draw_ColorPicker (x, y, path, i) {
  if (path[i][1] == 1) {
    Render.StringCustom(x, y, 0, path[i][2], [255, 255, 255, 255], Render.AddFont('Ebrima', 8, 150));
    Render.FilledRect(x + 155, y, 25, 14, [UI.GetValue(path[i][2] + "R"), UI.GetValue(path[i][2] + "G"), UI.GetValue(path[i][2] + "B"), UI.GetValue(path[i][2] + "A")])
    Render.Rect(x + 155, y, 25, 14, [255, 255, 255, 255]);
    if (mouse_in_rect(x + 150, y, 25, 14) && mouse_left_click()) {
      UI.SetValue(path[i][2] + 'F', 1);
    }
    if (UI.GetValue(path[i][2] + 'F')) {
      Render.FilledRect(x + 200, y, 150, 140, [0, 0, 0, 155])
      Render.FilledRect(x + 210, y + 10, 100, 90, [UI.GetValue(path[i][2] + "R"), UI.GetValue(path[i][2] + "G"), UI.GetValue(path[i][2] + "B"), 255])

      Render.GradientRect(x + 210, y + 10, 50, 90, 1, [255, 255, 255, 255], [255, 255, 255, 0])
      Render.GradientRect(x + 210, y + 40, 100, 60, 0, [0, 0, 0, 0], [0, 0, 0, 255])
      for (var hsv = 0; hsv < 360; hsv += 3) {
        Render.FilledRect(x + 320, y + 10 + hsv / 3, 15, 1, HSVToRGB([hsv, 100, 100]))
      }
      Render.FilledRect(x + 210, y + 110, 100, 15, [255, 255, 255, 255])
      for (var blocks = 0; blocks < 100; blocks += 10) {
        Render.FilledRect(x + 210 + blocks, y + 110, 5, 5, [200, 200, 200, 255])
        Render.FilledRect(x + 215 + blocks, y + 115, 5, 5, [200, 200, 200, 255])
        Render.FilledRect(x + 210 + blocks, y + 120, 5, 5, [200, 200, 200, 255])
      }
      Render.FilledRect(x + 210, y + 110, 100, 15, [UI.GetValue(path[i][2] + "R"), UI.GetValue(path[i][2] + "G"), UI.GetValue(path[i][2] + "B"), UI.GetValue(path[i][2] + "A")])
      Render.Rect(x + 209 + UI.GetValue(path[i][2] + "A") * 0.392, y + 110, 2, 15, [255, 255, 255, 255])
      Render.Rect(x + 208 + UI.GetValue(path[i][2] + "A") * 0.392, y + 110, 4, 15, [0, 0, 0, 255])
      if (mouse_in_rect(x + 210, y + 110, 100, 15)) {
        if (mouse_left_click()) {
          UI.SetValue(path[i][2] + "A", (mouse_pos[0] - x - 210) * 2.55)
        }
      }
      if (mouse_in_rect(x + 320, y + 10, 15, 120) && mouse_left_click()) {
        UI.SetValue(path[i][2] + "H",   (mouse_pos[1] - y - 10) * 3)
      }
      if (mouse_in_rect(x + 210, y + 10, 100, 90) && mouse_left_click()) {
        UI.SetValue(path[i][2] + "S", (mouse_pos[0] - x - 210))
        UI.SetValue(path[i][2] + "V",   (90 - (mouse_pos[1] - y - 10)) * 1.11)
      }
       
      UI.SetValue(path[i][2] + "R", HSVToRGB([UI.GetValue(path[i][2] + "H"),UI.GetValue( path[i][2] + "S"), UI.GetValue(path[i][2] + "V")])[0]);
      UI.SetValue(path[i][2] + "G", HSVToRGB([UI.GetValue(path[i][2] + "H"), UI.GetValue(path[i][2] + "S"), UI.GetValue(path[i][2] + "V")])[1]);
      UI.SetValue(path[i][2] + "B", HSVToRGB([UI.GetValue(path[i][2] + "H"), UI.GetValue(path[i][2] + "S"), UI.GetValue(path[i][2] + "V")])[2]);
      Render.Circle(x + 210 + UI.GetValue(path[i][2] + "S"), y + 10 + (90 - UI.GetValue(path[i][2] + "V") * 0.9), 3, [255, 255, 255, 255]);
      if (!mouse_in_rect(x + 200, y , 150, 140) && !mouse_in_rect(x + 155, y, 25, 14)) {
        if (mouse_left_click()) {
          UI.SetValue(path[i][2] + 'F', 0);
        }
      }
    } else {
      if (!mouse_in_rect(x, y, 25, 14)) {
      UI.SetValue(path[i][2] + 'F', 0);
    }

    }

    path[0].push(0);
  }

}
var Draw_HotKey = function (x, y, path, i) {
  if (path[i][1] == 1) {
    Render.StringCustom(x, y, 0, path[i][2], [255, 255, 255, 255], Render.AddFont('Ebrima', 8, 150));
    var setup = UI.GetValue('Misc', 'JAVASCRIPT', 'Script items', path[i][2] + '0');
    var view_text = '[]'
    if (mouse_in_rect(x + 160, y, 30, 18) && mouse_left_click()) { UI.SetValue('Misc', 'JAVASCRIPT', 'Script items', path[i][2] + '0', 1) }
    if (setup == 0) {
      view_text = '[-]'
    }
    if (setup == 1) {
      view_text = '[...]'
      for (var hotlisten = 0; hotlisten < HotKey_Codes.length; hotlisten++) {
        if (Input.IsKeyPressed(HotKey_Codes[hotlisten][1]) && !mouse_in_rect(x, y, 30, 20)) {
          UI.SetValue('Misc', 'JAVASCRIPT', 'Script items', path[i][2] + '1', hotlisten)
          UI.SetValue('Misc', 'JAVASCRIPT', 'Script items', path[i][2] + '0', 2)
        }
      }
    }
    if (setup == 2) {
      view_text = '[' + HotKey_Codes[UI.GetValue('Misc', 'JAVASCRIPT', 'Script items', path[i][2] + '1')][0] + ']'
    }
    if (mouse_in_rect(x + 160, y, 30, 18)) {
      if (mouse_right_click()) {
        UI.SetValue('Misc', 'JAVASCRIPT', 'Script items', path[i][2] + '2', 1)
      }
    } else {
      if (!mouse_in_rect(x + 175, y + 5, 40, 42)) {
        if (mouse_left_click() || mouse_right_click()) { UI.SetValue('Misc', 'JAVASCRIPT', 'Script items', path[i][2] + '2', 0) }
      }
    }
    if (UI.GetValue('Misc', 'JAVASCRIPT', 'Script items', path[i][2] + '2')) {
      if (UI.GetValue('Misc', 'JAVASCRIPT', 'Script items', path[i][2] + '3')) {
        Render.StringCustom(x + 200, y + 10, 0, 'hold', [255, 255, 255, 100], Render.AddFont('Vedana', 7, 700));
        Render.StringCustom(x + 200, y + 31, 0, 'toggle', [255, 255, 255, 255], Render.AddFont('Vedana', 7, 700));
      } else {
        Render.StringCustom(x + 200, y + 10, 0, 'hold', [255, 255, 255, 255], Render.AddFont('Vedana', 7, 700));
        Render.StringCustom(x + 200, y + 31, 0, 'toggle', [255, 255, 255, 100], Render.AddFont('Vedana', 7, 700));
      }
      if (mouse_in_rect(x + 200, y + 5, 40, 20) && mouse_left_click()) { UI.SetValue('Misc', 'JAVASCRIPT', 'Script items', path[i][2] + '3', 0) }
      if (mouse_in_rect(x + 200, y + 26, 40, 20) && mouse_left_click()) { UI.SetValue('Misc', 'JAVASCRIPT', 'Script items', path[i][2] + '3', 1) }
    }
    Render.StringCustom(x + 175, y, 1, view_text, [255, 255, 255, 255], Render.AddFont('Ebrima', 8, 150));

    path[0].push(0);
  }
}
function Listen_HotKey (name) {
  if (UI.GetValue('Misc', 'JAVASCRIPT', 'Script items', name + '0') == 2) {
    if (UI.GetValue('Misc', 'JAVASCRIPT', 'Script items', name + '3') == 0) {
      UI.SetValue('Misc', 'JAVASCRIPT', 'Script items', name + '4', 0)
      if (Input.IsKeyPressed(HotKey_Codes[UI.GetValue('Misc', 'JAVASCRIPT', 'Script items', name + '1')][1])) {
        UI.SetValue('Misc', 'JAVASCRIPT', 'Script items', name + '4', 1)
      }
    }
    if (UI.GetValue('Misc', 'JAVASCRIPT', 'Script items', name + '3')) {
      if (Input.IsKeyPressed(HotKey_Codes[UI.GetValue('Misc', 'JAVASCRIPT', 'Script items', name + '1')][1])) {
        UI.SetValue('Misc', 'JAVASCRIPT', 'Script items', name + 'l', UI.GetValue('Misc', 'JAVASCRIPT', 'Script items', name + 'l') + 1)
        if (UI.GetValue('Misc', 'JAVASCRIPT', 'Script items', name + 'l') >= 1 && UI.GetValue('Misc', 'JAVASCRIPT', 'Script items', name + 'l') < 4) {
          UI.SetValue('Misc', 'JAVASCRIPT', 'Script items', name + '4', !UI.GetValue('Misc', 'JAVASCRIPT', 'Script items', name + '4'))
        }
  
      } else { UI.SetValue('Misc', 'JAVASCRIPT', 'Script items', name + 'l', 0) }
    }
  }
}
function Is_KeyUsing (name) {
  if (UI.GetValue(name + "4")) return true;
}
var Draw_Place = function (x, y, for_use, path) {
  for (var for_use = 1; for_use < path.length; for_use++) {
    if (path[for_use][0] == Transferr.Lable) {
      Draw_Lable(x, y + path[0].length * 18, path, for_use);
    }
    if (path[for_use][0] == Transferr.CheckBox) {
      Draw_CheckBox(x, y + path[0].length * 18, path, for_use);
    }
    if (path[for_use][0] == Transferr.IntSlider || path[for_use][0] == Transferr.FloatSlider) {
      Draw_Slider(x, y + path[0].length * 18, path, for_use);
    }
    if (path[for_use][0] == Transferr.DropDown) {
      Draw_DropDown(x, y + path[0].length * 18, path, for_use);
    }
    if (path[for_use][0] == Transferr.MultiDropDown) {
      Draw_MultiDropDown(x, y + path[0].length * 18, path, for_use);
    }
    if (path[for_use][0] == Transferr.ColorPicker) {
      Draw_ColorPicker(x, y + path[0].length * 18, path, for_use);
    }
    if (path[for_use][0] == Transferr.HotKey) {
      Draw_HotKey(x, y + path[0].length * 18, path, for_use);
    }
  }
  path[0] = [];
}
var UI_GetValue = function (path, name) {
  for (var contials = 1; contials < path.length; contials++) {
    if (path[contials][2] == name) {
      switch (path[contials][0]) {
        case 0x30: {
          return path[contials][2];
        }
        case 0x31: {
          return UI.GetValue(path[contials][2])
        }
        case 0x32: {
          return UI.GetValue(path[contials][2])
        }
        case 0x33: {
          return UI.GetValue(path[contials][2])
        }
        case 0x34: {
          return [UI.GetValue(path[contials][2] + "R"), UI.GetValue(path[contials][2] + "G"), UI.GetValue(path[contials][2] + "B"), UI.GetValue(path[contials][2] + "A")]
        }
        case 0x35: {
          return UI.GetValue(path[contials][2])
        }
        case 0x36: {
          var return_data = [];
          for (var mult_for = 0; mult_for < path[contials][3].length; mult_for++) {
            if (UI.GetValue(path[contials][2] + mult_for.toString())) {
              return_data.push(1);
            } else {
              return_data.push(0);
            }
          }
          return return_data;
        }
        case 0x37: {
          return path[contials][3];
        }
      }
    }
  }
}

//By lex1337